home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 2 / Gold Medal Software Volume 2 (Gold Medal) (1994).iso / utils / 4dos50a.arj / ALIASES (.txt) < prev    next >
Microsoft Windows Help File Content  |  1993-11-23  |  10KB  |  175 lines

  1. :                     ALIASES -- 4DOS Sample Alias File
  2. :     The aliases in this file are designed to give you some examples of
  3. :     how 4DOS aliases can be used and the power they have.  It is not
  4. :     intended to be an exhaustive list, and many of these may not be
  5. :     appropriate for your needs.  But they should give you a feel for how
  6. :     to use aliases to help get your work done.
  7. :     CAUTION:  These aliases are EXAMPLES.  We do NOT promise that they
  8. :     will work properly when run on your system.  They are simply intended
  9. :     to show what's possible and give you a feel for how to write your
  10. :     own set of aliases.  You may find some of them useful, but others
  11. :     may fail or have unintended effects when they are run on a system
  12. :     other than the one they were designed for.
  13. :     This file is designed to be loaded with an ALIAS /R command, for
  14. :     example:
  15. :               alias /r aliases
  16. :     You can also load aliases from a batch file, but ALIAS /R is much
  17. :     faster.  See the manual for more details on loading aliases.
  18. :     We suggest you put your standard aliases are in a self-contained
  19. :     file like this one which can be invoked from AUTOEXEC.  That
  20. :     way the file can also be re-invoked after it is edited, to re-
  21. :     install the aliases.
  22. :     The next few aliases set up some directory commands that provide
  23. :     shorthand ways to view the directory in several different formats
  24. :     (see the DIR command in the manual for more details).
  25. :     Note that none of these aliases has any arguments specified (%1,
  26. :     %2, etc.).  This means that all arguments on the actual command line
  27. :     will be appended to the alias text.  For example:
  28. :             d2 x*
  29. :     is equivalent to:
  30. :             dir /2pv x*
  31. :     and:
  32. :             d2 x* y* z*
  33. :     is equivalent to:
  34. :             dir /2pv x* y* z*
  35. d2 dir /2pv
  36. de dir /oe
  37. dir *dir /p
  38. wh*ereis dir /dp
  39. :     The last two commands above demonstrate the use of an asterisk to
  40. :     terminate alias expansion and to shorten the name of an alias.
  41. :     In the first case, if the command were defined as:
  42. :             alias dir dir/p
  43. :     it would generate an alias loop error.  The inclusion of the "*"
  44. :     makes 4DOS terminate alias expansion for that command, which
  45. :     allows the redefinition of a command with specific switch settings.
  46. :     In this case "dir" is redefined as "dir/p", which will cause
  47. :     directories to be displayed with a pause at the end of each page.
  48. :     The "whereis" command demonstrates truncation of an alias name.
  49. :     The * is placed after the last required character in the name, so
  50. :     the "whereis" command can be entered as "wh", "whe", "wher",
  51. :     "where", "wherei", or "whereis".
  52. :     The following aliases are more shorthand:  DD and DU (directory
  53. :     down and directory up) for pushd and popd, DX (shows only the
  54. :     subdirectorie, L for list, etc.
  55. dd pushd
  56. du popd
  57. dx *dir /mwad
  58. l list
  59. clr mode mono
  60. :     Aliases can also be used to modify the behavior of some internal
  61. :     commands.  The two examples below show how you can force DELETE and
  62. :     MOVE to prompt before execution.  If you need to use the unprompted
  63. :     command, use the leading asterisk ("*DEL").
  64. del*ete *del /p
  65. move *move /r
  66. :     The next aliases show how some commands can be enhanced.  Instead of
  67. :     always prompting you for new values, TIME and DATE can simply report
  68. :     the current information.
  69. date echo Today is %_dow %_date
  70. time echo The time is %_time
  71. :     Here's what the next few aliases do:
  72. :             more:   Uses 4DOS's LIST /S as a substitute for the DOS MORE
  73. :                     command.  Note the use of the * to allow the command
  74. :                     to be entered as MO, MOR, or MORE
  75. :             sdel:   Allows you to select files for deletion from a subset
  76. :                     of files as specified in the command argument.  For
  77. :                     example:
  78. :                             sdel *.obj
  79. :                     will allow you to select files to delete from a list
  80. :                     of all .obj files.  (See the SELECT command in the
  81. :                     manual for more details).
  82. :             up:     Moves "up" in the directory tree, i.e. to the parent
  83. :                     directory.
  84. :             ov:     Moves "over" in the directory tree, to another subdi-
  85. :                     rectory which has the same parent as the current
  86. :                     directory.
  87. mo*re list /s
  88. sdel select del (%1)
  89. up cd ..
  90. ov cd ..\%1
  91. :     The next two aliases show how arguments can be passed to commands.
  92. :     In both cases the argument given when the alias is invoked is passed
  93. :     to the program at the appropriate place in its command string.
  94. lp lpr -u %1 >lpt1
  95. ps d:\peri\ps /t:%1 /e:4
  96. :     The next few aliases demonstrate several things.  Some use the
  97. :     command separator character ^ to include multiple commands in
  98. :     the alias.  ND2 uses the "&&" (AND) operator so that the second
  99. :     command is only executed if the first was succcessful.  The last
  100. :     two (PC and BACK) use the alias called IN to do their job.  In
  101. :     fact IN was designed for "internal" use by other aliases in this
  102. :     file, though it could be used elsewhere as well.  Note that, while
  103. :     PX is set up before it is referenced in other aliases, this is not
  104. :     really necessary, because any command in one alias which refers to
  105. :     another is handled when the alias is invoked, not when it is set
  106. :     up with the alias command.
  107. :     Here's what each alias does:
  108. :             nd:     Creates a new directory below the current directory,
  109. :                     then changes to it.
  110. :             nd2:    Attempts to creates the specified directory on any
  111. :                     drive, then changes to it if the creation was
  112. :                     successful.
  113. :             w:      Saves the current directory, changes to the ws
  114. :                     directory on drive c:, runs the ws program using
  115. :                     the first argument on the command line, and
  116. :                     restores the original directory when done.
  117. :             zap:    Deletes all the .bak files in the current directory,
  118. :                     then does a wide directory listing.
  119. :             in:     "Pushes" a different directory, executes a command,
  120. :                     including all of the arguments on the command line,
  121. :                     and then goes back to the original directory.  See
  122. :                     PUSHD, POPD, and Alias Parameters in the manual for
  123. :                     more details.
  124. :             pc:     Changes to the \comm directory on drive c:, runs
  125. :                     the program called pcomm, then returns to the
  126. :                     drive and directory in use when the command was
  127. :                     executed.
  128. :             back:   Changes to the \backup directory on drive d:, runs
  129. :                     the program called tape, then returns to the previous
  130. :                     drive and directory.
  131. nd md %1^cd %1
  132. nd2 md %1 && *cdd %1
  133. w pushd c:\wp^ws %1^popd
  134. zap del *.bak^dir /w
  135. in pushd %1^%2&^popd
  136. pc in c:\comm pcomm
  137. back in d:\backup tape
  138. :     The following aliases make use of the %& argument.  This argument
  139. :     means "all of the arguments on the command line".  For example:
  140. :             zap2 *.bak *.lst *.bk!
  141. :     expands to:
  142. :             erase *.bak *.lst *.bk!^chkdsk^dir /w
  143. :     The last of the three aliases below uses the %@eval function to
  144. :     create a command-line calculator, by simply passing all arguments
  145. :     on the command line to the function.
  146. zap2 erase %&^chkdsk^dir /w
  147. ed edit %&^del *.bak
  148. cal*c echo The answer is:  %@eval[%&]
  149. :     The following two aliases, taken from the manual, show how to 
  150. :     combine alias with keystack to invoke a program and pass parameters
  151. :     to it.  See the manual for details on what they do.  Note that the
  152. :     0s in the keystack strings simulate an empty keyboard buffer; the
  153. :     13s are carriage returns.
  154. 321 keystack 0 13 0 13 0 13 0 13 0 13 "/fr" 0 "%1" 13^123
  155. drpt pushd c:\data^keystack "use times index times" 13 "report form timerep to print" 13 "quit" 13^dbase^popd
  156. :     The following aliases show the use of IFF in aliases.  The first
  157. :     redefines SET so that it displays the environment variables with a
  158. :     /P if no parameters are given, or processes the SET if parameters
  159. :     are specified.  The second checks whether the argument is a directory;
  160. :     if so it deletes the files in the directory and then removes the
  161. :     directory.  If not, it gives an error message.
  162. set iff "%1"=="" then ^ *set /p ^ else *set %& ^ endiff
  163. zap iff isdir %1 then ^ *del %1 ^ *rd %1 ^ else ^ beep ^ echo Not a directory! ^ endiff
  164. :     You can also assign any alias to a keystroke to save a lot of typing.
  165. :     Check your manual for the proper way to express keynames.
  166. :     The following examples reassign the following keys:
  167. :        F5:        wide directory
  168. :           Ctrl-F1    clear screen
  169. :           Shift-F10: "EXIT" + ENTER  (useful then "shelling out")
  170. :           Alt-F1:    invokes another HELP program
  171. @f5 dir /w
  172. @Ctrl-F1 cls
  173. @shift-f10 exit 
  174. @alt-f1 c:\dos\help
  175.